package transactionimplementation

import (
	"reflect"
	"salary/database"
	"salary/modelimplementation"
	"time"
)

type ServiceChargeTransaction struct {
	date     time.Time
	charge   float64
	memberId int
}

func (sct *ServiceChargeTransaction) Execute() {
	e := database.Database.GetUnionMember(sct.memberId)
	af := e.GetAffiliation()
	if reflect.TypeOf(af) == reflect.TypeOf(modelimplementation.UnionAffiliation{}) {
		uaf := af.(*modelimplementation.UnionAffiliation)
		uaf.AddServiceCharge(sct.date, sct.charge)
	}
}
